#!/usr/bin/env python
# -*- coding: utf-8 -*- 

#
# Generated  by generateDS.py version 2.7b.
#

import sys
import getopt
import re as re_

etree_ = None
Verbose_import_ = False
(   XMLParser_import_none, XMLParser_import_lxml,
    XMLParser_import_elementtree
    ) = range(3)
XMLParser_import_library = None
try:
    # lxml
    from lxml import etree as etree_
    XMLParser_import_library = XMLParser_import_lxml
    if Verbose_import_:
        print("running with lxml.etree")
except ImportError:
    try:
        # cElementTree from Python 2.5+
        import xml.etree.cElementTree as etree_
        XMLParser_import_library = XMLParser_import_elementtree
        if Verbose_import_:
            print("running with cElementTree on Python 2.5+")
    except ImportError:
        try:
            # ElementTree from Python 2.5+
            import xml.etree.ElementTree as etree_
            XMLParser_import_library = XMLParser_import_elementtree
            if Verbose_import_:
                print("running with ElementTree on Python 2.5+")
        except ImportError:
            try:
                # normal cElementTree install
                import cElementTree as etree_
                XMLParser_import_library = XMLParser_import_elementtree
                if Verbose_import_:
                    print("running with cElementTree")
            except ImportError:
                try:
                    # normal ElementTree install
                    import elementtree.ElementTree as etree_
                    XMLParser_import_library = XMLParser_import_elementtree
                    if Verbose_import_:
                        print("running with ElementTree")
                except ImportError:
                    raise ImportError("Failed to import ElementTree from any known place")

def parsexml_(*args, **kwargs):
    if (XMLParser_import_library == XMLParser_import_lxml and
        'parser' not in kwargs):
        # Use the lxml ElementTree compatible parser so that, e.g.,
        #   we ignore comments.
        kwargs['parser'] = etree_.ETCompatXMLParser()
    doc = etree_.parse(*args, **kwargs)
    return doc

#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these methods by re-implementing the following class
#   in a module named generatedssuper.py.

try:
    from generatedssuper import GeneratedsSuper
except ImportError, exp:

    class GeneratedsSuper(object):
        def gds_format_string(self, input_data, input_name=''):
            return input_data
        def gds_validate_string(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer(self, input_data, input_name=''):
            return '%d' % input_data
        def gds_validate_integer(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_integer_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of integers')
            return input_data
        def gds_format_float(self, input_data, input_name=''):
            return '%f' % input_data
        def gds_validate_float(self, input_data, node, input_name=''):
            return input_data
        def gds_format_float_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_float_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of floats')
            return input_data
        def gds_format_double(self, input_data, input_name=''):
            return '%e' % input_data
        def gds_validate_double(self, input_data, node, input_name=''):
            return input_data
        def gds_format_double_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_double_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of doubles')
            return input_data
        def gds_format_boolean(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean(self, input_data, node, input_name=''):
            return input_data
        def gds_format_boolean_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                if value not in ('true', '1', 'false', '0', ):
                    raise_parse_error(node, 'Requires sequence of booleans ("true", "1", "false", "0")')
            return input_data
        def gds_str_lower(self, instring):
            return instring.lower()
        def get_path_(self, node):
            path_list = []
            self.get_path_list_(node, path_list)
            path_list.reverse()
            path = '/'.join(path_list)
            return path
        Tag_strip_pattern_ = re_.compile(r'\{.*\}')
        def get_path_list_(self, node, path_list):
            if node is None:
                return
            tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag)
            if tag:
                path_list.append(tag)
            self.get_path_list_(node.getparent(), path_list)
        def get_class_obj_(self, node, default_class=None):
            class_obj1 = default_class
            if 'xsi' in node.nsmap:
                classname = node.get('{%s}type' % node.nsmap['xsi'])
                if classname is not None:
                    names = classname.split(':')
                    if len(names) == 2:
                        classname = names[1]
                    class_obj2 = globals().get(classname)
                    if class_obj2 is not None:
                        class_obj1 = class_obj2
            return class_obj1
        def gds_build_any(self, node, type_name=None):
            return None


#
# If you have installed IPython you can uncomment and use the following.
# IPython is available from http://ipython.scipy.org/.
#

## from IPython.Shell import IPShellEmbed
## args = ''
## ipshell = IPShellEmbed(args,
##     banner = 'Dropping into IPython',
##     exit_msg = 'Leaving Interpreter, back to program.')

# Then use the following line where and when you want to drop into the
# IPython shell:
#    ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')

#
# Globals
#

ExternalEncoding = 'ascii'
Tag_pattern_ = re_.compile(r'({.*})?(.*)')
String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')

#
# Support/utility functions.
#

def showIndent(outfile, level):
    for idx in range(level):
        outfile.write('    ')

def quote_xml(inStr):
    if not inStr:
        return ''
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    return s1

def quote_attrib(inStr):
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    if '"' in s1:
        if "'" in s1:
            s1 = '"%s"' % s1.replace('"', "&quot;")
        else:
            s1 = "'%s'" % s1
    else:
        s1 = '"%s"' % s1
    return s1

def quote_python(inStr):
    s1 = inStr
    if s1.find("'") == -1:
        if s1.find('\n') == -1:
            return "'%s'" % s1
        else:
            return "'''%s'''" % s1
    else:
        if s1.find('"') != -1:
            s1 = s1.replace('"', '\\"')
        if s1.find('\n') == -1:
            return '"%s"' % s1
        else:
            return '"""%s"""' % s1

def get_all_text_(node):
    if node.text is not None:
        text = node.text
    else:
        text = ''
    for child in node:
        if child.tail is not None:
            text += child.tail
    return text

def find_attr_value_(attr_name, node):
    attrs = node.attrib
    attr_parts = attr_name.split(':')
    value = None
    if len(attr_parts) == 1:
        value = attrs.get(attr_name)
    elif len(attr_parts) == 2:
        prefix, name = attr_parts
        namespace = node.nsmap.get(prefix)
        if namespace is not None:
            value = attrs.get('{%s}%s' % (namespace, name, ))
    return value


class GDSParseError(Exception):
    pass

def raise_parse_error(node, msg):
    if XMLParser_import_library == XMLParser_import_lxml:
        msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, )
    else:
        msg = '%s (element %s)' % (msg, node.tag, )
    raise GDSParseError(msg)


class MixedContainer:
    # Constants for category:
    CategoryNone = 0
    CategoryText = 1
    CategorySimple = 2
    CategoryComplex = 3
    # Constants for content_type:
    TypeNone = 0
    TypeText = 1
    TypeString = 2
    TypeInteger = 3
    TypeFloat = 4
    TypeDecimal = 5
    TypeDouble = 6
    TypeBoolean = 7
    def __init__(self, category, content_type, name, value):
        self.category = category
        self.content_type = content_type
        self.name = name
        self.value = value
    def getCategory(self):
        return self.category
    def getContenttype(self, content_type):
        return self.content_type
    def getValue(self):
        return self.value
    def getName(self):
        return self.name
    def export(self, outfile, level, name, namespace):
        if self.category == MixedContainer.CategoryText:
            # Prevent exporting empty content as empty lines.
            if self.value.strip(): 
                outfile.write(self.value)
        elif self.category == MixedContainer.CategorySimple:
            self.exportSimple(outfile, level, name)
        else:    # category == MixedContainer.CategoryComplex
            self.value.export(outfile, level, namespace,name)
    def exportSimple(self, outfile, level, name):
        if self.content_type == MixedContainer.TypeString:
            outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeInteger or \
                self.content_type == MixedContainer.TypeBoolean:
            outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeFloat or \
                self.content_type == MixedContainer.TypeDecimal:
            outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeDouble:
            outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
    def exportLiteral(self, outfile, level, name):
        if self.category == MixedContainer.CategoryText:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        elif self.category == MixedContainer.CategorySimple:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        else:    # category == MixedContainer.CategoryComplex
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \
                (self.category, self.content_type, self.name,))
            self.value.exportLiteral(outfile, level + 1)
            showIndent(outfile, level)
            outfile.write(')\n')


class MemberSpec_(object):
    def __init__(self, name='', data_type='', container=0):
        self.name = name
        self.data_type = data_type
        self.container = container
    def set_name(self, name): self.name = name
    def get_name(self): return self.name
    def set_data_type(self, data_type): self.data_type = data_type
    def get_data_type_chain(self): return self.data_type
    def get_data_type(self):
        if isinstance(self.data_type, list):
            if len(self.data_type) > 0:
                return self.data_type[-1]
            else:
                return 'xs:string'
        else:
            return self.data_type
    def set_container(self, container): self.container = container
    def get_container(self): return self.container

def _cast(typ, value):
    if typ is None or value is None:
        return value
    return typ(value)

#
# Data representation classes.
#

class parsegen(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, image_types_list=None):
        self.image_types_list = image_types_list
    def factory(*args_, **kwargs_):
        if parsegen.subclass:
            return parsegen.subclass(*args_, **kwargs_)
        else:
            return parsegen(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_image_types_list(self): return self.image_types_list
    def set_image_types_list(self, image_types_list): self.image_types_list = image_types_list
    def export(self, outfile, level, namespace_='tns:', name_='parsegen', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='parsegen')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='parsegen'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='parsegen', fromsubclass_=False):
        if self.image_types_list is not None:
            self.image_types_list.export(outfile, level, namespace_, name_='image_types_list', )
    def hasContent_(self):
        if (
            self.image_types_list is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='parsegen'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.image_types_list is not None:
            showIndent(outfile, level)
            outfile.write('image_types_list=model_.complex_image_types_list(\n')
            self.image_types_list.exportLiteral(outfile, level, name_='image_types_list')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'image_types_list':
            obj_ = complex_image_types_list.factory()
            obj_.build(child_)
            self.set_image_types_list(obj_)
# end class parsegen


class complex_image_types_list(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, image_type=None):
        if image_type is None:
            self.image_type = []
        else:
            self.image_type = image_type
    def factory(*args_, **kwargs_):
        if complex_image_types_list.subclass:
            return complex_image_types_list.subclass(*args_, **kwargs_)
        else:
            return complex_image_types_list(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_image_type(self): return self.image_type
    def set_image_type(self, image_type): self.image_type = image_type
    def add_image_type(self, value): self.image_type.append(value)
    def insert_image_type(self, index, value): self.image_type[index] = value
    def export(self, outfile, level, namespace_='tns:', name_='complex_image_types_list', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_image_types_list')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_image_types_list'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_image_types_list', fromsubclass_=False):
        for image_type_ in self.image_type:
            image_type_.export(outfile, level, namespace_, name_='image_type')
    def hasContent_(self):
        if (
            self.image_type
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_image_types_list'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('image_type=[\n')
        level += 1
        for image_type_ in self.image_type:
            showIndent(outfile, level)
            outfile.write('model_.complex_image_type(\n')
            image_type_.exportLiteral(outfile, level, name_='complex_image_type')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'image_type':
            obj_ = complex_image_type.factory()
            obj_.build(child_)
            self.image_type.append(obj_)
# end class complex_image_types_list


class complex_image_type(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, id=None, file_type=None, mbn_properties=None, elf_properties=None, ewm_properties=None, pmbl_properties=None):
        self.id = _cast(None, id)
        self.file_type = file_type
        self.mbn_properties = mbn_properties
        self.elf_properties = elf_properties
        self.ewm_properties = ewm_properties
        self.pmbl_properties = pmbl_properties
    def factory(*args_, **kwargs_):
        if complex_image_type.subclass:
            return complex_image_type.subclass(*args_, **kwargs_)
        else:
            return complex_image_type(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_file_type(self): return self.file_type
    def set_file_type(self, file_type): self.file_type = file_type
    def get_mbn_properties(self): return self.mbn_properties
    def set_mbn_properties(self, mbn_properties): self.mbn_properties = mbn_properties
    def get_elf_properties(self): return self.elf_properties
    def set_elf_properties(self, elf_properties): self.elf_properties = elf_properties
    def get_ewm_properties(self): return self.ewm_properties
    def set_ewm_properties(self, ewm_properties): self.ewm_properties = ewm_properties
    def get_pmbl_properties(self): return self.pmbl_properties
    def set_pmbl_properties(self, pmbl_properties): self.pmbl_properties = pmbl_properties
    def get_id(self): return self.id
    def set_id(self, id): self.id = id
    def export(self, outfile, level, namespace_='tns:', name_='complex_image_type', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_image_type')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_image_type'):
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_image_type', fromsubclass_=False):
        if self.file_type is not None:
            showIndent(outfile, level)
            outfile.write('<%sfile_type>%s</%sfile_type>\n' % (namespace_, self.gds_format_string(quote_xml(self.file_type).encode(ExternalEncoding), input_name='file_type'), namespace_))
        if self.mbn_properties is not None:
            self.mbn_properties.export(outfile, level, namespace_, name_='mbn_properties')
        if self.elf_properties is not None:
            self.elf_properties.export(outfile, level, namespace_, name_='elf_properties')
        if self.ewm_properties is not None:
            self.ewm_properties.export(outfile, level, namespace_, name_='ewm_properties')
        if self.pmbl_properties is not None:
            self.pmbl_properties.export(outfile, level, namespace_, name_='pmbl_properties')
    def hasContent_(self):
        if (
            self.file_type is not None or
            self.mbn_properties is not None or
            self.elf_properties is not None or
            self.ewm_properties is not None or
            self.pmbl_properties is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_image_type'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            showIndent(outfile, level)
            outfile.write('id = "%s",\n' % (self.id,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.file_type is not None:
            showIndent(outfile, level)
            outfile.write('file_type=%s,\n' % quote_python(self.file_type).encode(ExternalEncoding))
        if self.mbn_properties is not None:
            showIndent(outfile, level)
            outfile.write('mbn_properties=model_.complex_mbn_properties(\n')
            self.mbn_properties.exportLiteral(outfile, level, name_='mbn_properties')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.elf_properties is not None:
            showIndent(outfile, level)
            outfile.write('elf_properties=model_.complex_elf_properties(\n')
            self.elf_properties.exportLiteral(outfile, level, name_='elf_properties')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.ewm_properties is not None:
            showIndent(outfile, level)
            outfile.write('ewm_properties=model_.complex_ewm_properties(\n')
            self.ewm_properties.exportLiteral(outfile, level, name_='ewm_properties')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.pmbl_properties is not None:
            showIndent(outfile, level)
            outfile.write('pmbl_properties=model_.complex_pmbl_properties(\n')
            self.pmbl_properties.exportLiteral(outfile, level, name_='pmbl_properties')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('id', node)
        if value is not None and 'id' not in already_processed:
            already_processed.append('id')
            self.id = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'file_type':
            file_type_ = child_.text
            file_type_ = self.gds_validate_string(file_type_, node, 'file_type')
            self.file_type = file_type_
        elif nodeName_ == 'mbn_properties':
            obj_ = complex_mbn_properties.factory()
            obj_.build(child_)
            self.set_mbn_properties(obj_)
        elif nodeName_ == 'elf_properties':
            obj_ = complex_elf_properties.factory()
            obj_.build(child_)
            self.set_elf_properties(obj_)
        elif nodeName_ == 'ewm_properties':
            obj_ = complex_ewm_properties.factory()
            obj_.build(child_)
            self.set_ewm_properties(obj_)
        elif nodeName_ == 'pmbl_properties':
            obj_ = complex_pmbl_properties.factory()
            obj_.build(child_)
            self.set_pmbl_properties(obj_)
# end class complex_image_type


class complex_mbn_properties(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, header_size=None):
        self.header_size = header_size
    def factory(*args_, **kwargs_):
        if complex_mbn_properties.subclass:
            return complex_mbn_properties.subclass(*args_, **kwargs_)
        else:
            return complex_mbn_properties(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_header_size(self): return self.header_size
    def set_header_size(self, header_size): self.header_size = header_size
    def export(self, outfile, level, namespace_='tns:', name_='complex_mbn_properties', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_mbn_properties')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_mbn_properties'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_mbn_properties', fromsubclass_=False):
        if self.header_size is not None:
            showIndent(outfile, level)
            outfile.write('<%sheader_size>%s</%sheader_size>\n' % (namespace_, self.gds_format_integer(self.header_size, input_name='header_size'), namespace_))
    def hasContent_(self):
        if (
            self.header_size is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_mbn_properties'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.header_size is not None:
            showIndent(outfile, level)
            outfile.write('header_size=%d,\n' % self.header_size)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'header_size':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'header_size')
            self.header_size = ival_
# end class complex_mbn_properties


class complex_pmbl_properties(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, preamble_size=None, has_magic_num=None, ota_enabled=None, page_size=None, num_of_pages=None, min_size_with_pad=None):
        self.preamble_size = preamble_size
        self.has_magic_num = has_magic_num
        self.ota_enabled = ota_enabled
        self.page_size = page_size
        self.num_of_pages = num_of_pages
        self.min_size_with_pad = min_size_with_pad
    def factory(*args_, **kwargs_):
        if complex_pmbl_properties.subclass:
            return complex_pmbl_properties.subclass(*args_, **kwargs_)
        else:
            return complex_pmbl_properties(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_preamble_size(self): return self.preamble_size
    def set_preamble_size(self, preamble_size): self.preamble_size = preamble_size
    def get_has_magic_num(self): return self.has_magic_num
    def set_has_magic_num(self, has_magic_num): self.has_magic_num = has_magic_num
    def get_ota_enabled(self): return self.ota_enabled
    def set_ota_enabled(self, ota_enabled): self.ota_enabled = ota_enabled
    def get_page_size(self): return self.page_size
    def set_page_size(self, page_size): self.page_size = page_size
    def get_num_of_pages(self): return self.num_of_pages
    def set_num_of_pages(self, num_of_pages): self.num_of_pages = num_of_pages
    def get_min_size_with_pad(self): return self.min_size_with_pad
    def set_min_size_with_pad(self, min_size_with_pad): self.min_size_with_pad = min_size_with_pad
    def export(self, outfile, level, namespace_='tns:', name_='complex_pmbl_properties', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_pmbl_properties')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_pmbl_properties'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_pmbl_properties', fromsubclass_=False):
        if self.preamble_size is not None:
            showIndent(outfile, level)
            outfile.write('<%spreamble_size>%s</%spreamble_size>\n' % (namespace_, self.gds_format_integer(self.preamble_size, input_name='preamble_size'), namespace_))
        if self.has_magic_num is not None:
            showIndent(outfile, level)
            outfile.write('<%shas_magic_num>%s</%shas_magic_num>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.has_magic_num)), input_name='has_magic_num'), namespace_))
        if self.ota_enabled is not None:
            showIndent(outfile, level)
            outfile.write('<%sota_enabled>%s</%sota_enabled>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.ota_enabled)), input_name='ota_enabled'), namespace_))
        if self.page_size is not None:
            showIndent(outfile, level)
            outfile.write('<%spage_size>%s</%spage_size>\n' % (namespace_, self.gds_format_integer(self.page_size, input_name='page_size'), namespace_))
        if self.num_of_pages is not None:
            showIndent(outfile, level)
            outfile.write('<%snum_of_pages>%s</%snum_of_pages>\n' % (namespace_, self.gds_format_integer(self.num_of_pages, input_name='num_of_pages'), namespace_))
        if self.min_size_with_pad is not None:
            showIndent(outfile, level)
            outfile.write('<%smin_size_with_pad>%s</%smin_size_with_pad>\n' % (namespace_, self.gds_format_integer(self.min_size_with_pad, input_name='min_size_with_pad'), namespace_))
    def hasContent_(self):
        if (
            self.preamble_size is not None or
            self.has_magic_num is not None or
            self.ota_enabled is not None or
            self.page_size is not None or
            self.num_of_pages is not None or
            self.min_size_with_pad is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_pmbl_properties'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.preamble_size is not None:
            showIndent(outfile, level)
            outfile.write('preamble_size=%d,\n' % self.preamble_size)
        if self.has_magic_num is not None:
            showIndent(outfile, level)
            outfile.write('has_magic_num=%s,\n' % self.has_magic_num)
        if self.ota_enabled is not None:
            showIndent(outfile, level)
            outfile.write('ota_enabled=%s,\n' % self.ota_enabled)
        if self.page_size is not None:
            showIndent(outfile, level)
            outfile.write('page_size=%d,\n' % self.page_size)
        if self.num_of_pages is not None:
            showIndent(outfile, level)
            outfile.write('num_of_pages=%d,\n' % self.num_of_pages)
        if self.min_size_with_pad is not None:
            showIndent(outfile, level)
            outfile.write('min_size_with_pad=%d,\n' % self.min_size_with_pad)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'preamble_size':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'preamble_size')
            self.preamble_size = ival_
        elif nodeName_ == 'has_magic_num':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'has_magic_num')
            self.has_magic_num = ival_
        elif nodeName_ == 'ota_enabled':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'ota_enabled')
            self.ota_enabled = ival_
        elif nodeName_ == 'page_size':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'page_size')
            self.page_size = ival_
        elif nodeName_ == 'num_of_pages':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'num_of_pages')
            self.num_of_pages = ival_
        elif nodeName_ == 'min_size_with_pad':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'min_size_with_pad')
            self.min_size_with_pad = ival_
# end class complex_pmbl_properties


class complex_elf_properties(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, has_hash_table=None, has_multi_image_segment=False, has_license_manager_segment=False, has_sections=False, max_elf_segments=None, image_type=None, hash_seg_placement=None, validate_ph_addrs=None, validate_vir_addrs=None):
        self.has_hash_table = has_hash_table
        self.has_multi_image_segment = has_multi_image_segment
        self.has_license_manager_segment = has_license_manager_segment
        self.has_sections = has_sections
        self.max_elf_segments = max_elf_segments
        self.image_type = image_type
        self.hash_seg_placement = hash_seg_placement
        self.validate_ph_addrs = validate_ph_addrs
        self.validate_vir_addrs = validate_vir_addrs
    def factory(*args_, **kwargs_):
        if complex_elf_properties.subclass:
            return complex_elf_properties.subclass(*args_, **kwargs_)
        else:
            return complex_elf_properties(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_has_hash_table(self): return self.has_hash_table
    def set_has_hash_table(self, has_hash_table): self.has_hash_table = has_hash_table
    def get_has_multi_image_segment(self): return self.has_multi_image_segment
    def set_has_multi_image_segment(self, has_multi_image_segment): self.has_multi_image_segment = has_multi_image_segment
    def get_has_license_manager_segment(self): return self.has_license_manager_segment
    def set_has_license_manager_segment(self, has_license_manager_segment): self.has_license_manager_segment = has_license_manager_segment
    def get_has_sections(self): return self.has_sections
    def set_has_sections(self, has_sections): self.has_sections = has_sections
    def get_max_elf_segments(self): return self.max_elf_segments
    def set_max_elf_segments(self, max_elf_segments): self.max_elf_segments = max_elf_segments
    def get_image_type(self): return self.image_type
    def set_image_type(self, image_type): self.image_type = image_type
    def get_hash_seg_placement(self): return self.hash_seg_placement
    def set_hash_seg_placement(self, hash_seg_placement): self.hash_seg_placement = hash_seg_placement
    def get_validate_ph_addrs(self): return self.validate_ph_addrs
    def set_validate_ph_addrs(self, validate_ph_addrs): self.validate_ph_addrs = validate_ph_addrs
    def get_validate_vir_addrs(self): return self.validate_vir_addrs
    def set_validate_vir_addrs(self, validate_vir_addrs): self.validate_vir_addrs = validate_vir_addrs
    def export(self, outfile, level, namespace_='tns:', name_='complex_elf_properties', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_elf_properties')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_elf_properties'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_elf_properties', fromsubclass_=False):
        if self.has_hash_table is not None:
            showIndent(outfile, level)
            outfile.write('<%shas_hash_table>%s</%shas_hash_table>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.has_hash_table)), input_name='has_hash_table'), namespace_))
        if self.has_multi_image_segment is not None:
            showIndent(outfile, level)
            outfile.write('<%shas_multi_image_segment>%s</%shas_multi_image_segment>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.has_multi_image_segment)), input_name='has_multi_image_segment'), namespace_))
        if self.has_license_manager_segment is not None:
            showIndent(outfile, level)
            outfile.write('<%shas_license_manager_segment>%s</%shas_license_manager_segment>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.has_license_manager_segment)), input_name='has_license_manager_segment'), namespace_))
        if self.has_sections is not None:
            showIndent(outfile, level)
            outfile.write('<%shas_sections>%s</%shas_sections>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.has_sections)), input_name='has_sections'), namespace_))
        if self.max_elf_segments is not None:
            showIndent(outfile, level)
            outfile.write('<%smax_elf_segments>%s</%smax_elf_segments>\n' % (namespace_, self.gds_format_integer(self.max_elf_segments, input_name='max_elf_segments'), namespace_))
        if self.image_type is not None:
            showIndent(outfile, level)
            outfile.write('<%simage_type>%s</%simage_type>\n' % (namespace_, self.gds_format_integer(self.image_type, input_name='image_type'), namespace_))
        if self.hash_seg_placement is not None:
            showIndent(outfile, level)
            outfile.write('<%shash_seg_placement>%s</%shash_seg_placement>\n' % (namespace_, self.gds_format_string(quote_xml(self.hash_seg_placement).encode(ExternalEncoding), input_name='hash_seg_placement'), namespace_))
        if self.validate_ph_addrs is not None:
            showIndent(outfile, level)
            outfile.write('<%svalidate_ph_addrs>%s</%svalidate_ph_addrs>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.validate_ph_addrs)), input_name='validate_ph_addrs'), namespace_))
        if self.validate_vir_addrs is not None:
            showIndent(outfile, level)
            outfile.write('<%svalidate_vir_addrs>%s</%svalidate_vir_addrs>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.validate_vir_addrs)), input_name='validate_vir_addrs'), namespace_))
    def hasContent_(self):
        if (
            self.has_hash_table is not None or
            self.has_multi_image_segment is not None or
            self.has_license_manager_segment is not None or
            self.has_sections is not None or
            self.max_elf_segments is not None or
            self.image_type is not None or
            self.hash_seg_placement is not None or
            self.validate_ph_addrs is not None or
            self.validate_vir_addrs is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_elf_properties'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.has_hash_table is not None:
            showIndent(outfile, level)
            outfile.write('has_hash_table=%s,\n' % self.has_hash_table)
        if self.has_multi_image_segment is not None:
            showIndent(outfile, level)
            outfile.write('has_multi_image_segment=%s,\n' % self.has_multi_image_segment)
        if self.has_license_manager_segment is not None:
            showIndent(outfile, level)
            outfile.write('has_license_manager_segment=%s,\n' % self.has_license_manager_segment)
        if self.has_sections is not None:
            showIndent(outfile, level)
            outfile.write('has_sections=%s,\n' % self.has_sections)
        if self.max_elf_segments is not None:
            showIndent(outfile, level)
            outfile.write('max_elf_segments=%d,\n' % self.max_elf_segments)
        if self.image_type is not None:
            showIndent(outfile, level)
            outfile.write('image_type=%d,\n' % self.image_type)
        if self.hash_seg_placement is not None:
            showIndent(outfile, level)
            outfile.write('hash_seg_placement=%s,\n' % quote_python(self.hash_seg_placement).encode(ExternalEncoding))
        if self.validate_ph_addrs is not None:
            showIndent(outfile, level)
            outfile.write('validate_ph_addrs=%s,\n' % self.validate_ph_addrs)
        if self.validate_vir_addrs is not None:
            showIndent(outfile, level)
            outfile.write('validate_vir_addrs=%s,\n' % self.validate_vir_addrs)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'has_hash_table':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'has_hash_table')
            self.has_hash_table = ival_
        elif nodeName_ == 'has_multi_image_segment':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'has_multi_image_segment')
            self.has_multi_image_segment = ival_
        elif nodeName_ == 'has_license_manager_segment':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'has_license_manager_segment')
            self.has_license_manager_segment = ival_
        elif nodeName_ == 'has_sections':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'has_sections')
            self.has_sections = ival_
        elif nodeName_ == 'max_elf_segments':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'max_elf_segments')
            self.max_elf_segments = ival_
        elif nodeName_ == 'image_type':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError), exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'image_type')
            self.image_type = ival_
        elif nodeName_ == 'hash_seg_placement':
            hash_seg_placement_ = child_.text
            hash_seg_placement_ = self.gds_validate_string(hash_seg_placement_, node, 'hash_seg_placement')
            self.hash_seg_placement = hash_seg_placement_
        elif nodeName_ == 'validate_ph_addrs':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'validate_ph_addrs')
            self.validate_ph_addrs = ival_
        elif nodeName_ == 'validate_vir_addrs':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'validate_vir_addrs')
            self.validate_vir_addrs = ival_
# end class complex_elf_properties


class complex_ewm_properties(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, image_entry=None, relocatable=None):
        self.image_entry = image_entry
        self.relocatable = relocatable
    def factory(*args_, **kwargs_):
        if complex_ewm_properties.subclass:
            return complex_ewm_properties.subclass(*args_, **kwargs_)
        else:
            return complex_ewm_properties(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_image_entry(self): return self.image_entry
    def set_image_entry(self, image_entry): self.image_entry = image_entry
    def get_relocatable(self): return self.relocatable
    def set_relocatable(self, relocatable): self.relocatable = relocatable
    def export(self, outfile, level, namespace_='tns:', name_='complex_ewm_properties', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='complex_ewm_properties')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='tns:', name_='complex_ewm_properties'):
        pass
    def exportChildren(self, outfile, level, namespace_='tns:', name_='complex_ewm_properties', fromsubclass_=False):
        if self.image_entry is not None:
            showIndent(outfile, level)
            outfile.write('<%simage_entry>%s</%simage_entry>\n' % (namespace_, self.gds_format_string(quote_xml(self.image_entry).encode(ExternalEncoding), input_name='image_entry'), namespace_))
        if self.relocatable is not None:
            showIndent(outfile, level)
            outfile.write('<%srelocatable>%s</%srelocatable>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.relocatable)), input_name='relocatable'), namespace_))
    def hasContent_(self):
        if (
            self.image_entry is not None or
            self.relocatable is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='complex_ewm_properties'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.image_entry is not None:
            showIndent(outfile, level)
            outfile.write('image_entry=%s,\n' % quote_python(self.image_entry).encode(ExternalEncoding))
        if self.relocatable is not None:
            showIndent(outfile, level)
            outfile.write('relocatable=%s,\n' % self.relocatable)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'image_entry':
            image_entry_ = child_.text
            image_entry_ = self.gds_validate_string(image_entry_, node, 'image_entry')
            self.image_entry = image_entry_
        elif nodeName_ == 'relocatable':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'relocatable')
            self.relocatable = ival_
# end class complex_ewm_properties


USAGE_TEXT = """
Usage: python <Parser>.py [ -s ] <in_xml_file>
"""

def usage():
    print USAGE_TEXT
    sys.exit(1)


def get_root_tag(node):
    tag = Tag_pattern_.match(node.tag).groups()[-1]
    rootClass = globals().get(tag)
    return tag, rootClass


def parse(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'parsegen'
        rootClass = parsegen
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_=rootTag, 
        namespacedef_='xmlns:tns="http://www.qualcomm.com/parsegen"')
    return rootObj


def parseString(inString):
    from StringIO import StringIO
    doc = parsexml_(StringIO(inString))
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'parsegen'
        rootClass = parsegen
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_="parsegen",
        namespacedef_='xmlns:tns="http://www.qualcomm.com/parsegen"')
    return rootObj


def parseLiteral(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'parsegen'
        rootClass = parsegen
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('#from auto_gen_xml_config import *\n\n')
    sys.stdout.write('import auto_gen_xml_config as model_\n\n')
    sys.stdout.write('rootObj = model_.rootTag(\n')
    rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
    sys.stdout.write(')\n')
    return rootObj


def main():
    args = sys.argv[1:]
    if len(args) == 1:
        parse(args[0])
    else:
        usage()


if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()


__all__ = [
    "complex_elf_properties",
    "complex_ewm_properties",
    "complex_image_type",
    "complex_image_types_list",
    "complex_mbn_properties",
    "complex_pmbl_properties",
    "parsegen"
    ]
